/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package SimpleQM.util;

import SimpleQM.*;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see SimpleQM.SimpleQMPackage
 * @generated
 */
public class SimpleQMSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static SimpleQMPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SimpleQMSwitch() {
		if (modelPackage == null) {
			modelPackage = SimpleQMPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case SimpleQMPackage.ROOT: {
				Root root = (Root)theEObject;
				T result = caseRoot(root);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QELEMENT: {
				QElement qElement = (QElement)theEObject;
				T result = caseQElement(qElement);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QO_S: {
				QoS qoS = (QoS)theEObject;
				T result = caseQoS(qoS);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QO_SCHARACTERISTIC: {
				QoSCharacteristic qoSCharacteristic = (QoSCharacteristic)theEObject;
				T result = caseQoSCharacteristic(qoSCharacteristic);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QO_SLATENCY: {
				QoS_latency qoS_latency = (QoS_latency)theEObject;
				T result = caseQoS_latency(qoS_latency);
				if (result == null) result = caseQoSCharacteristic(qoS_latency);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QO_SAVAILABILITY: {
				QoS_availability qoS_availability = (QoS_availability)theEObject;
				T result = caseQoS_availability(qoS_availability);
				if (result == null) result = caseQoSCharacteristic(qoS_availability);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QO_SDISASTER_RECOVERY: {
				QoS_disasterRecovery qoS_disasterRecovery = (QoS_disasterRecovery)theEObject;
				T result = caseQoS_disasterRecovery(qoS_disasterRecovery);
				if (result == null) result = caseQoSCharacteristic(qoS_disasterRecovery);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QO_SSECURITY: {
				QoS_security qoS_security = (QoS_security)theEObject;
				T result = caseQoS_security(qoS_security);
				if (result == null) result = caseQoSCharacteristic(qoS_security);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SimpleQMPackage.QO_SCOSTS: {
				QoS_costs qoS_costs = (QoS_costs)theEObject;
				T result = caseQoS_costs(qoS_costs);
				if (result == null) result = caseQoSCharacteristic(qoS_costs);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Root</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Root</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseRoot(Root object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>QElement</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>QElement</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQElement(QElement object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Qo S</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Qo S</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQoS(QoS object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Qo SCharacteristic</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Qo SCharacteristic</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQoSCharacteristic(QoSCharacteristic object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Qo Slatency</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Qo Slatency</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQoS_latency(QoS_latency object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Qo Savailability</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Qo Savailability</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQoS_availability(QoS_availability object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Qo Sdisaster Recovery</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Qo Sdisaster Recovery</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQoS_disasterRecovery(QoS_disasterRecovery object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Qo Ssecurity</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Qo Ssecurity</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQoS_security(QoS_security object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Qo Scosts</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Qo Scosts</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseQoS_costs(QoS_costs object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //SimpleQMSwitch
